package com.aysafety.iotdataplatformclient.configurer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

@Component
@ChannelHandler.Sharable
public class IotDataPlatformClientHandler extends ChannelInboundHandlerAdapter {
    private Logger logger = LoggerFactory.getLogger(IotDataPlatformClientHandler.class);

    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        String JSONMessage = msg.toString();
        logger.info("JSONMessage:" + JSONMessage);
        ctx.close();
    }
}
